import { Http } from "@/utils/request";
import { Toast } from "@/utils/toast";
import { delayTask } from "@/utils/timer";

const baseUrl = "/tour_order";

export const get_product_buy_api = (
  data: { order_id: string },
  showError = true
) => {
  return Http.get<{ product_status: number; product_id: string }>(
    `/v1${baseUrl}/get_product_buy`,
    data
  ).catch(error => {
    showError && delayTask(60, () => Toast.show(error.message));
    return Promise.reject(error);
  });
};
